Fix a few small issues in xc_domain_dumpcore:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 9 Mar 2006 22:07:27 +0000 (23:07 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 9 Mar 2006 22:07:27 +0000 (23:07 +0100)
xc_domain_getinfo returns information about a domain, but not
necessarily the one you asked about.  Add check for this.

max_vcpu_id in xc_domain_getinfo is really an ID, not a count, so
make the loop include the last VCPU

Signed-off-by: Ben Thomas <ben@virtualiron.com>
tools/libxc/xc_core.c

index 6e403f0e9949ca43e7e96575bc2f9f26e451bd48..7e198ba8916ed0e2d7fe951c32d47892bdb74f87 100644 (file)
@@ -54,9 +54,14 @@ xc_domain_dumpcore(int xc_handle,
         goto error_out;
     }
  
-    for (i = 0; i < info.max_vcpu_id; i++)
+    if (domid != info.domid) {
+        PERROR("Domain %d does not exist", domid);
+        goto error_out;
+    }
+
+    for (i = 0; i <= info.max_vcpu_id; i++)
         if (xc_vcpu_getcontext(xc_handle, domid,
-                                       i, &ctxt[nr_vcpus]) == 0)
+                               i, &ctxt[nr_vcpus]) == 0)
             nr_vcpus++;
  
     nr_pages = info.nr_pages;